# FROM node为第一阶段，主要是实现前端包的安装及项目打包
FROM node:latest as builder 
# 设置工作目录
WORKDIR /app
# copy 
COPY package*.json 
RUN npm install   
COPY . .
# 打包
RUN npm run build



#  nginx:latest 镜像而构建
FROM nginx   
# 将项目根目录下 dist 文件夹中的所有文件复制到镜像中 /usr/share/nginx/html/ 目录下
# COPY ../../hqx/ /usr/share/nginx/html/  
COPY --from=builder /app/hqx  /usr/share/nginx/html
# COPY --from=0 /app/nginx.conf /etc/nginx/conf.d/default.conf
# 本地的 default.conf 配置来替换 Nginx 镜像里的默认配置。
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf  


EXPOSE 80